package com.iv.durian.cloud.facade;


import com.iv.durian.cloud.Notice;
import com.iv.durian.cloud.Serve;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Component
@FeignClient(name = Serve.SERVICE_NAME)
@RequestMapping("/service/notice")
public interface NoticeFacade {

    @RequestMapping(path = "/get/{noticeId}", method = RequestMethod.GET)
    Notice get(@PathVariable(value = "noticeId") Integer noticeId);

    @RequestMapping(value = "/getBylessionId/{lessionId}", method = RequestMethod.GET)
    Notice get(@PathVariable(value="lessionId") int lessionId);

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    void add(@RequestBody Notice notice);

    @RequestMapping(value = "/update", method = RequestMethod.POST)
    void update(@RequestBody  Notice notice);

    @RequestMapping(value = "/remove/{noticeId}", method = RequestMethod.POST)
    int remove(@PathVariable("noticeId") Integer noticeId);

    @RequestMapping(value = "/list", method = RequestMethod.POST)
    List<Notice> list(
            @RequestParam(value = "lessionId", required = false) Integer lessionId,
            @RequestParam(value = "offset", required = false) Integer offset,
            @RequestParam(value = "limit", required = false) Integer limit
    );

    @RequestMapping(value = "/count", method = RequestMethod.POST)
    int count(@RequestBody Notice notice);
}
